﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using RhythmComet.Physics;
using FMOD;
using RhythmComet.Services;
using RhythmComet.Particles;
using System;

namespace RhythmComet
{
    public interface IGameState 
    {
        GameState Value { get; }
    }

    public class GameState : DrawableGameComponent, IGameState
    {
        protected IGameStateManager GameManager;
        protected IInputHandler Input;
        protected Rectangle TitleSafeArea;

        protected RhythmCometGame game;

        public GameState(Game game)
            : base(game)
        {
            this.game = (RhythmCometGame) game;
            GameManager = (IGameStateManager)game.Services.GetService(
                typeof(IGameStateManager));
            Input = (IInputHandler)game.Services.GetService(
                typeof(IInputHandler));
        }

        public virtual void StateChanged(object sender, EventArgs e)
        {
            if (GameManager.State == this.Value)
                Visible = Enabled = true;
            else
                Visible = Enabled = false;
        }

        public GameState Value
        {
            get { return (this); }
        }
    }
}
